<?php 
        $status = $bom->getStatus()?  $bom->getStatus()  : 0;
        $approvestatus = $bom->getApprovalstatus ()? $bom->getApprovalstatus ():0;
        $action = CommonValues::$gBomStatus['action'][$status];
?>
<td>
   
<ul class="sf_admin_td_actions">  
    <li>
    <?
       if (($approvestatus == CommonValues::$gMRApprovalStatus['key']['Approved'])&& $sf_user->hasCredential('EDIT_BOM'))
            echo link_to(image_tag('/sf/sf_admin/images/date.png', array('alt' => __('Change Date'), 'title' => __('Change Date'))), 'bom/ChangeDate?id='.$bom->getId());
    ?>
 </li> 
  <li><?php
      echo link_to(image_tag('/sf/sf_admin/images/edit.png', array('alt' => __('change no'), 'title' => __('change no'))), 'bom/changeNumber?id='.$bom->getId());
      if ($status== CommonValues::$gBomStatus['key']['Initial'])
      {
          echo link_to(image_tag('/sf/sf_admin/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'bom/delete?id='.$bom->getId(), array (
            'post' => true,
            'confirm' => __('Are you sure you want to delete this BOM?'),));
      }
      else
      {
          if ($sf_user->hasGroup('Administrator'))
          {
              echo link_to(image_tag('/sf/sf_admin/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'bom/delete?id='.$bom->getId(), array (
            'post' => true,
            'confirm' => __('Are you sure you want to delete this BOM? This action will also delete all MR, PO, TI related.'),));
          }
      }
    ?>
  </li>

  <li>
  <? 
    if ($action=='COMPLETED')
    {
        echo image_tag('/sf/sf_admin/images/completed_icon.png', array('alt' => __('Completed'), 'title' => __('Completed')));
    }
    elseif($action =='revise')
    {
        if ($bom && $bom->getApprovalstatus() == CommonValues::$gMRApprovalStatus['key']['Waiting for approval']){
            echo link_to(image_tag('/sf/sf_admin/images/' .  'cancel_icon.png', array('alt' =>'cancel', 'title' => 'cancel')), 'bom/'.'cancel'.'?id='.$bom->getId(), array ('post' => true,
            'confirm' => __('Are you sure you want to cancel?'),));
        }
        else
            echo link_to(image_tag('/sf/sf_admin/images/' . $action. '_icon.png', array('alt' =>$action, 'title' => $action)), 'bom/'.$action.'?id='.$bom->getId(), array ('post' => true,
            'confirm' => __('Are you sure you want to '.$action.'?'),
            ));
    }
    elseif ($action != 'UNACTION')
    {
            echo link_to(image_tag('/sf/sf_admin/images/' . $action. '_icon.png', array('alt' =>$action, 'title' => $action)), 'bom/'.$action.'?id='.$bom->getId(), array (
              'post' => true,
              'confirm' => __('Are you sure you want to '.$action.'?'),
            ));
    }
    ?>
    </li>
    

<li>
<?
if ($status == CommonValues::$gBomStatus['key']['Rejected'])
    echo link_to(image_tag('/sf/sf_admin/images/viewnotes_icon.png', array('alt' => __('view notes'), 'title' => __('view notes'))), 'bom/viewNotes?id='.$bom->getId());
?>
</li>
    
<li>
<?
if ($status != CommonValues::$gBomStatus['key']['Initial'])
    echo link_to(image_tag('/sf/sf_admin/images/print.png', array('alt' => __('print'), 'title' => __('print'))), 'bom/print?id='.$bom->getId());
?>
</li>

</ul>
</td>
